package com.ruoyi.user.api.factory;


import com.ruoyi.common.core.domain.User;
import com.ruoyi.user.api.RemoteUserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserService> {

    private static final Logger log = LoggerFactory.getLogger(RemoteUserFallbackFactory.class);
    @Override
    public RemoteUserService create(Throwable throwable) {
        log.error("日志服务调用失败:{}", throwable.getMessage());
        return new RemoteUserService(){
            @Override
            public Integer registerUser(User user, String source) {
                return -1;
            }
        };
    }
}
